<?php


namespace App\Commons\Domain\Module\Financial\Model;


use App\Commons\Domain\Core\Model;
use App\Commons\Domain\Module\Coin\Model\Coin;
use App\Commons\Domain\Module\UserCenter\Model\Member;


/**
 * App\Commons\Domain\Module\Financial\Model\Wallet
 *
 * @property int $id
 * @property \Illuminate\Support\Carbon $created_at
 * @property \Illuminate\Support\Carbon $updated_at
 * @property string $uid
 * @property int $coin_id 币种id
 * @property string $balance 余额
 * @property string $frozen_balance 冻结余额，交易中的数量
 * @property string $address 钱包地址
 * @property string|null $locked_at 锁定时间，锁定后不能交易
 * @property string $to_released 待释放余额，充值待确认数量
 * @property string $private_key 私钥
 * @property string|null $wallet_file 钱包文件路径
 * @property-read Coin $coin
 * @property-read Member $member
 * @method static \Illuminate\Database\Eloquent\Builder|Wallet newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|Wallet newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|Wallet query()
 * @method static \Illuminate\Database\Eloquent\Builder|Wallet whereAddress($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Wallet whereBalance($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Wallet whereCoinId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Wallet whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Wallet whereFrozenBalance($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Wallet whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Wallet whereLockedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Wallet wherePrivateKey($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Wallet whereToReleased($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Wallet whereUid($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Wallet whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Wallet whereWalletFile($value)
 * @mixin \Eloquent
 */
class Wallet extends Model
{
    /**
     * 所属币种
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function coin()
    {
        return $this->belongsTo(Coin::class, 'coin_id', 'id');
    }

    /**
     * 所属用户
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function member()
    {
        return $this->belongsTo(Member::class, 'uid', 'uid');
    }
}
